stack = []
s = '((){}[<>])'
for i in s:
    if i in '({[<':
        stack.append(i)
    else:
        if i == ')' and stack[-1] == '(':
            stack.pop()
        elif i == '}' and stack[-1] == '{':
              stack.pop()
        elif i == ']' and stack[-1] == '[':
              stack.pop()
        elif i == '>' and stack[-1] == '<':
              stack.pop()
        else:
            break
if len(stack) == 0:
     print(True)
else:
     print(False)
if i == ')' and stack[-1] == '(' and stack[-2] == ')':
    print(False)
